package com.kizuki.spring;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.lang.Nullable;

import javax.annotation.Resource;

// 自动装bean
public class AutoBean {

    // byName
    @Autowired
    @Qualifier("r0")
    private AutoBeanRef0 r0;

    // 先byName 后byType
    @Resource
    @Nullable // 可为空
    private AutoBeanRef1 r1;


    public AutoBeanRef0 getR0() {
        return r0;
    }

    public void setR0(AutoBeanRef0 r0) {
        this.r0 = r0;
    }

    public AutoBeanRef1 getR1() {
        return r1;
    }


    public void setR1(AutoBeanRef1 r1) {
        this.r1 = r1;
    }

    @Override
    public String toString() {
        return "AutoBean{" +
                "r0=" + r0 +
                ", r1=" + r1 +
                '}';
    }
}
